class Article < ActiveRecord::Base
    belongs_to :blog
    def wiki_format_text text
        # TODO: Сложи яките джаваскрипт истории
        text = RedCloth.new(text).to_html
        return text
    end

    alias old_update update_attributes
    def update_attributes article
        article["text"] = wiki_format_text article["contents"]
        old_update article
    end
end
